package cn.flying.base.process.listener.eventlistener;

import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.engine.delegate.event.impl.ActivitiActivityEventImpl;
import org.springframework.stereotype.Component;

/**
 * @description: 执行节点取消监听
 * @author: lvyong
 * @date: 2023年02月26日 08:22
 * @version: 1.0
 */
@Component
public class ActivityCancelledListener implements ActivitiEventListener {
    /**
     * Called when an event has been fired
     *
     * @param event the event
     */
    @Override
    public void onEvent(ActivitiEvent event) {
        System.out.println("==========start===========");
        System.out.println("活动取消监听");
        System.out.println("事件类型：" + event.getType().name());
        ActivitiActivityEventImpl entityEvent = (ActivitiActivityEventImpl) event;
        System.out.println(entityEvent.getExecutionId());
        System.out.println("实体：" + entityEvent);
        System.out.println("==========end===========");
    }

    /**
     * @return whether or not the current operation should fail when this listeners execution throws an exception.
     */
    @Override
    public boolean isFailOnException() {
        return false;
    }
}
